// SwitchButton.h
#ifndef SWITCHBUTTON_H
#define SWITCHBUTTON_H

#include <QPushButton>
#include <QPropertyAnimation>

class SwitchButton : public QPushButton {
    Q_OBJECT
    Q_PROPERTY(int offset READ offset WRITE setOffset)

public:
    explicit SwitchButton(QWidget *parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event) override;

    private slots:
        void toggleState();

private:
    bool connected;
    int offset;
    QIcon disconnectedIcon;
    QIcon connectedIcon;

    int offset() const;
    void setOffset(int value);
};

#endif // SWITCHBUTTON_H
